package com.zgm.ch04.beanPostProcessor._8_1;

import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

public class SimpleBeanDemo {

	public static void main(String[] args){
		ConfigurableListableBeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("com/zgm/ch04/beanPostProcessor/_8_1/_8_1-context.xml"));////
		
		BeanPostProcessor bpp1 = (BeanPostProcessor) beanFactory.getBean("beanPostProcessor1");////
		BeanPostProcessor bpp2 = (BeanPostProcessor) beanFactory.getBean("beanPostProcessor2");////
		beanFactory.addBeanPostProcessor(bpp1);//
		beanFactory.addBeanPostProcessor(bpp2);//////
		
		SimpleBean sb = (SimpleBean) beanFactory.getBean("simpleBean");
		
		System.out.println(sb);
		
		beanFactory.destroySingletons();
	}
}
